package com.blazingredfireball.rouleurlog.ria.business
{
	import mx.rpc.IResponder;
	import com.adobe.cairngorm.business.ServiceLocator;
	import com.blazingredfireball.rouleurlog.ria.vo.BikeVO;
	
	public class BikeDelegate
	{
		private var responder : IResponder;
		private var service : Object;
		
		public function BikeDelegate(responder : IResponder)
		{
			this.service = ServiceLocator.getInstance().getService( "bikeService" );
			this.responder = responder;
		}
		
		public function getBikes(user_id : int) : void
		{			
			// For now I will not send user_id, just get all results. 
			// Future var call : Object = service.getBikes( user_id );
			var call : Object = service.getBikes();
			call.resultHandler = responder.result;
			call.faultHandler = responder.fault;	
		}
		
		public function createBike(bike : Object) : void
		{			
			var call : Object = service.createBike(bike);
			call.resultHandler = responder.result;
			call.faultHandler = responder.fault;	
		}
		
		public function deleteBike(id : int) : void
		{			
			var call : Object = service.deleteBike(id);
			call.resultHandler = responder.result;
			call.faultHandler = responder.fault;	
		}
		
		public function updateBike(id : int, bike : Object) : void
		{			
			var call : Object = service.updateBike(id, bike);
			call.resultHandler = responder.result;
			call.faultHandler = responder.fault;	
		}
		
	}
}